import request from '@/config/request';

// 我负责的机构列表
export function companyList (data?: {keyword: string}): Promise<any> {
  return request({
    url: '/business/company/getCompanyList',
    method: 'GET',
    data
  })
}

// 新建机构
export function addCompany (data: any): Promise<any> {
  return request({
    url: '/business/company',
    method: 'POST',
    data
  })
}

// 修改机构
export function editCompany (data: any): Promise<any> {
  return request({
    url: '/company/company',
    method: 'PUT',
    data
  })
}

// 获取当前登录账号的渠道下的业务员列表
export function getBusinessUserList (data: any): Promise<any> {
  // /business/company/getBusinessUserList -史博
  return request({
    url: '/system/user/business/list',
    method: 'GET',
    data
  })
}

// 机构详情
export function companyDetails (id: string): Promise<any> {
  return request({
    url: `/business/company/${id}`,
    method: 'GET',
  })
}

// 机构数据详情
export function statistical (id: string): Promise<any> {
  return request({
    url: `/business/company/statistical/${id}`,
    method: 'GET',
  })
}

// 我负责的机构专家列表
export function companyGetExpertList (id: string, data:any): Promise<any> {
  return request({
    url: `/business/company/expert/list/${id}`,
    method: 'GET',
    data
  })
}

// 获取机构下面的科室
export function getDeptList (parentId: number): Promise<any> {
  return request({
    url: `/system/dept/lists?saasType=3&parentId=${parentId}`,
    method: 'GET',
  })
}

// 获取医生职称
export function getPostList(): Promise<any> {
  return request({
    url: `/expert/post/optionselect`,
    method: 'GET'
  })
}

// 获取省市区
export function getAddressList(data: { level: number, pid?: string }): Promise<any> {
  return request({
    url: `/saas/area/allList`,
    method: 'GET',
    data
  })
}